//
//  BKCollectionViewLayout.h
//  XPhoto
//
//  Created by baboy on 2019/8/15.
//  Copyright © 2019 baboy. All rights reserved.
//

#import <UIKit/UIKit.h>

NS_ASSUME_NONNULL_BEGIN

#define SUPPLEMENTARY_KIND_HEADER_VIEW       @"header_view"
#define SUPPLEMENTARY_KIND_FOOTER_VIEW       @"footer_view"

typedef NS_ENUM(NSInteger, BKCollectionViewLayoutMode) {
    BKCollectionViewLayoutModeFixedWidthHeight          = 0, //固定宽和高,默认
    BKCollectionViewLayoutModeColumnAndRowSpan          = 1, //合并行或者列
};


@protocol BKCollectionViewLayoutDelegate;

@interface BKCollectionViewLayout : UICollectionViewLayout
@property(nonatomic, assign) id<BKCollectionViewLayoutDelegate> delegate;
@property(nonatomic, strong) NSMutableArray* itemAttributes;
@property(nonatomic, assign) BKCollectionViewLayoutMode layoutMode;
@property(nonatomic, assign) NSInteger numberOfColumns;
@end

@protocol BKCollectionViewLayoutDelegate <NSObject>

@optional
/**
 * 在当前section中，列数是多少,BKCollectionViewLayoutStyleFixedWidthHeight 模式下用到
 */
- (NSInteger)collectionViewLayout:(id)layout numberOfColumnsInSection:(NSInteger)section;

- (CGSize)  collectionViewLayout:(id)layout sizeForItemAtIndexPath:(NSIndexPath *)indexPath;
- (CGFloat) collectionViewLayout:(id)layout heightForItemInSection:(NSInteger)section;
- (CGFloat) collectionViewLayout:(id)layout heightForHeaderInSection:(NSInteger)section;
- (CGFloat) collectionViewLayout:(id)layout floatHeightForHeaderInSection:(NSInteger)section;
- (CGFloat) collectionViewLayout:(id)layout heightForFooterInSection:(NSInteger )section;

@end

NS_ASSUME_NONNULL_END
